﻿using System.Collections.Generic;
using offline2048;
using UnityEngine;
using TMPro;

public class CurrentCellImage : MonoBehaviour
{
    public SpriteRenderer Sp;
    public TextMeshPro NumberText;
    public GameObject Gem;
    public GameObject Doller;
    public float Scale;
    public void InitCurrent(int number,Color currentColor, bool hasGem)
    {
        transform.localScale = Vector2.zero;
        //Sp.color = currentColor;
        NumberText.text = "";//Utility.CellNumber(number);
        Sp.sprite = GameManager.instance.m_BlockImageList[number - 1];
        if(hasGem)
        {
            if (UserLayerManager.Instance.IsOrganic() || UserLayerManager.Instance.GetCurrentUserLayer() == UserLayerManager.UserLayerType.None)
            {
                Gem.SetActive(true);
                Doller.SetActive(false);
            }
            else
            {
                Gem.SetActive(false);
                Doller.SetActive(true);
            }
            
            AudioController.Play("Gem");
        }
        else
        {
            Gem.SetActive(false);
            Doller.SetActive(false);
        }

        LeanTween.scale(gameObject, new Vector3(Scale, Scale, 1), 0.2f);
    }
}
